<template>
	<view>
		<navbar :backshow="true" :title="title" :navBarHeight="navBarHeight" :menuRight="menuRight" :menuTop="menuTop"
			:menuHeight="menuHeight"></navbar>
		<!-- 头部展位 -->
		<view class="main" :style="{ height: mainheight + 'px' }"></view>
		<view class="userdatamain">
			<view class="userdataitem" @click="classfn">
				<!-- 	<view class="userdataicon">
					<image src="@/static/usertil.png" mode=""></image>
				</view> -->
				<view class="userdatadess">
					<view class="userdesname">
						{{classname}}
					</view>
					<view class="userdes">
						<span>{{classdata.length}}人</span>
						<uni-icons type="right" size="23"></uni-icons>

					</view>

				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "班级信息",
				navBarHeight: 0, // 导航栏高度
				menuRight: 0, // 胶囊距右方间距（方保持左、右间距一致）
				menuTop: 0, // 胶囊距底部间距（保持底部间距一致）
				menuHeight: 0, // 胶囊高度（自定义内容可与胶囊高度保证一致）
				mainheight: 0,
				classdata: [],
				classname: ''
			}
		},
		onLoad() {

			const that = this;

			// 获取系统信息
			const systemInfo = wx.getSystemInfoSync();
			// 胶囊按钮位置信息
			const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
			// 导航栏高度 = 状态栏高度 + 44
			that.navBarHeight = systemInfo.statusBarHeight + 44;
			that.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
			that.menuTop = menuButtonInfo.top;
			that.menuHeight = menuButtonInfo.height;
			that.mainheight = menuButtonInfo.top + menuButtonInfo.height;
			// 获取一下 最新数据
			this.$myRequest({
				url: '/client/appointmentUser/userInfo',

			}).then((res) => {
				console.log('获取用户信息', res.data);
				this.classname = res.data.organizationName

			})

			this.$myRequest({
				url: '/client/appointmentUser/organizationInfo',

			}).then((res) => {
				console.log('获取班级信息', res.data);

				this.classdata = res.data
			})
			// this.$myRequest({
			// 	url: "/client/appointment/deviceList",
			// 	method: "GET",
			// }).then((res) => {
			// 	this.devlist = res.data;
			// 	// console.log("设备列表", res.data);
			// });

		},
		methods: {
			classfn() {
				uni.navigateTo({
					url: "/pages/classdes/classdes"
				})
			},
		}
	}
</script>

<style>

</style>